\hypertarget{classdev_1_1net_1_1_socket_api}{}\section{dev\+:\+:net\+:\+:Socket\+Api Class Reference}
\label{classdev_1_1net_1_1_socket_api}\index{dev\+::net\+::\+Socket\+Api@{dev\+::net\+::\+Socket\+Api}}


本地套接字函数wrapper  




{\ttfamily \#include $<$Socket\+Api.\+hpp$>$}

\subsection*{Static Public Member Functions}
\begin{DoxyCompactItemize}
\item 
static sock\+\_\+t \hyperlink{classdev_1_1net_1_1_socket_api_a468438c9663cdc534e3bf628c29e7c75}{socket} (int domain, int type, int protocol=0)
\begin{DoxyCompactList}\small\item\em 创建一个套接字 \end{DoxyCompactList}\item 
static bool \hyperlink{classdev_1_1net_1_1_socket_api_ab9e728b6cb0b7932e73acbb250489e25}{bind} (sock\+\_\+t sockfd, const struct sockaddr $\ast$addr, socklen\+\_\+t addrlen)
\begin{DoxyCompactList}\small\item\em 绑定套接字到指定地址 \end{DoxyCompactList}\item 
static bool \hyperlink{classdev_1_1net_1_1_socket_api_a0cc819e43ff24147028aecbe7258b08e}{listen} (sock\+\_\+t sockfd, int backlog)
\begin{DoxyCompactList}\small\item\em 在指定套接字上启动监听 \end{DoxyCompactList}\item 
static sock\+\_\+t \hyperlink{classdev_1_1net_1_1_socket_api_a2e9851418b2c871852e441f73c1df495}{accept} (sock\+\_\+t sockfd, struct sockaddr $\ast$addr, socklen\+\_\+t $\ast$addrlen)
\begin{DoxyCompactList}\small\item\em 接收监听套接字上的连接 \end{DoxyCompactList}\item 
static bool \hyperlink{classdev_1_1net_1_1_socket_api_a4ac36cc16daf7f35ac40e70fdd52391b}{connect} (sock\+\_\+t sockfd, const struct sockaddr $\ast$addr, socklen\+\_\+t addrlen)
\begin{DoxyCompactList}\small\item\em 使用指定套接字连接到服务器 \end{DoxyCompactList}\item 
static bool \hyperlink{classdev_1_1net_1_1_socket_api_acab670d7ff1243462f782676d5f26931}{close} (sock\+\_\+t sockfd)
\begin{DoxyCompactList}\small\item\em 关闭指定套接字 \end{DoxyCompactList}\item 
static bool \hyperlink{classdev_1_1net_1_1_socket_api_aca13c6bb87f3118f3dd2c008238e3a5a}{shutdown} (sock\+\_\+t sockfd, int how)
\begin{DoxyCompactList}\small\item\em 关闭套接字一端 \end{DoxyCompactList}\item 
static ssize\+\_\+t \hyperlink{classdev_1_1net_1_1_socket_api_adea576bbc110685fbf0bd1faa36dd1f6}{recvfrom} (sock\+\_\+t sockfd, void $\ast$buffer, size\+\_\+t length, int flags, struct sockaddr $\ast$src\+\_\+addr, socklen\+\_\+t $\ast$addrlen)
\begin{DoxyCompactList}\small\item\em 接受数据报 \end{DoxyCompactList}\item 
static ssize\+\_\+t \hyperlink{classdev_1_1net_1_1_socket_api_a74d39e1ca0169a15f8e4cc6c6f9756ab}{sendto} (sock\+\_\+t sockfd, void $\ast$buffer, size\+\_\+t length, int flags, struct sockaddr $\ast$dest\+\_\+addr, socklen\+\_\+t addrlen)
\begin{DoxyCompactList}\small\item\em 发送数据报 \end{DoxyCompactList}\item 
static ssize\+\_\+t \hyperlink{classdev_1_1net_1_1_socket_api_ab5620cca4671a803d43ff11cddd29430}{recv} (sock\+\_\+t sockfd, void $\ast$buffer, size\+\_\+t length, int flags)
\begin{DoxyCompactList}\small\item\em 接受数据 \end{DoxyCompactList}\item 
static ssize\+\_\+t \hyperlink{classdev_1_1net_1_1_socket_api_a6747c98d432dda18d52ca8602d5c024c}{send} (sock\+\_\+t sockfd, const void $\ast$buffer, size\+\_\+t length, int flags)
\begin{DoxyCompactList}\small\item\em 发送数据 \end{DoxyCompactList}\item 
static uint16\+\_\+t \hyperlink{classdev_1_1net_1_1_socket_api_a2dadafc2cc647d97ab5091e8dc12195c}{htons} (uint16\+\_\+t host\+\_\+uint16)
\begin{DoxyCompactList}\small\item\em 主机字节序转换为网络字节序 \end{DoxyCompactList}\item 
static uint32\+\_\+t \hyperlink{classdev_1_1net_1_1_socket_api_a349f48bfc1f677bc3361a0be8ab47783}{htonl} (uint32\+\_\+t host\+\_\+uint32)
\begin{DoxyCompactList}\small\item\em 主机字节序转换为网络字节序 \end{DoxyCompactList}\item 
static uint16\+\_\+t \hyperlink{classdev_1_1net_1_1_socket_api_a4dd6d37153baf0f3b28a1a86e9e3513b}{ntohs} (uint16\+\_\+t net\+\_\+uint16)
\begin{DoxyCompactList}\small\item\em 网络字节序转换为主机字节序 \end{DoxyCompactList}\item 
static uint32\+\_\+t \hyperlink{classdev_1_1net_1_1_socket_api_ab645166633b0002c46951033027d022c}{ntohl} (uint32\+\_\+t net\+\_\+uint32)
\begin{DoxyCompactList}\small\item\em 网络字节序转换为主机字节序 \end{DoxyCompactList}\item 
static int \hyperlink{classdev_1_1net_1_1_socket_api_a191d49266fd9aa8149240009fa204e98}{inet\+\_\+pton} (int domain, const char $\ast$src\+\_\+str, void $\ast$addrptr)
\begin{DoxyCompactList}\small\item\em 转换点分十进制表示的地址为二进制格式 \end{DoxyCompactList}\item 
static const char $\ast$ \hyperlink{classdev_1_1net_1_1_socket_api_a3ae6728572945a50592d06e06ca1681c}{inet\+\_\+ntop} (int domain, const void $\ast$addrptr, char $\ast$dst\+\_\+ptr, size\+\_\+t len)
\begin{DoxyCompactList}\small\item\em 转换二进制格式的地址为点分十进制表示 \end{DoxyCompactList}\item 
static bool \hyperlink{classdev_1_1net_1_1_socket_api_ac30763c26a24cd674efa9e6804d9e448}{getaddrinfo} (const char $\ast$host, const char $\ast$service, const struct addrinfo $\ast$hints, struct addrinfo $\ast$$\ast$result)
\begin{DoxyCompactList}\small\item\em 获取指定主机名和服务名的套接字地址列表 \end{DoxyCompactList}\item 
static void \hyperlink{classdev_1_1net_1_1_socket_api_a2139efc71f04f29f6cd6d47217a68fc6}{freeaddrinfo} (struct addrinfo $\ast$result)
\begin{DoxyCompactList}\small\item\em 释放getaddrinfo返回的数据 \end{DoxyCompactList}\item 
static bool \hyperlink{classdev_1_1net_1_1_socket_api_a6137e6bc83ca8599a0e87c7534808c62}{getnameinfo} (const struct sockaddr $\ast$addr, socklen\+\_\+t addrlen, char $\ast$host, size\+\_\+t hostlen, char $\ast$service, size\+\_\+t servlen, int flags)
\begin{DoxyCompactList}\small\item\em 获取指定套接字地址的主机名和服务名 \end{DoxyCompactList}\item 
static bool \hyperlink{classdev_1_1net_1_1_socket_api_acdaa0a5aadc721422f748f8f931daa53}{getsockname} (sock\+\_\+t sockfd, struct sockaddr $\ast$addr, socklen\+\_\+t $\ast$addrlen)
\begin{DoxyCompactList}\small\item\em 获取套接字本地地址 \end{DoxyCompactList}\item 
static bool \hyperlink{classdev_1_1net_1_1_socket_api_afb96ed718ee882239929e15f68f4cfa1}{getpeername} (sock\+\_\+t sockfd, struct sockaddr $\ast$addr, socklen\+\_\+t $\ast$addrlen)
\begin{DoxyCompactList}\small\item\em 获取套接字远程地址 \end{DoxyCompactList}\item 
static bool \hyperlink{classdev_1_1net_1_1_socket_api_a508935c561a3841e65d6a7e794503758}{getsockopt} (sock\+\_\+t sockfd, int level, int optname, void $\ast$optval, socklen\+\_\+t $\ast$optlen)
\begin{DoxyCompactList}\small\item\em 获取套接字选项 \end{DoxyCompactList}\item 
static bool \hyperlink{classdev_1_1net_1_1_socket_api_aebfd2453f8424cebb9dc467d1cea40dd}{setsockopt} (sock\+\_\+t sockfd, int level, int optname, const void $\ast$optval, socklen\+\_\+t optlen)
\begin{DoxyCompactList}\small\item\em 设置套接字选项 \end{DoxyCompactList}\item 
static int \hyperlink{classdev_1_1net_1_1_socket_api_af8c6ff0f1ef50696e975920048a4ebf9}{select} (int nfds, fd\+\_\+set $\ast$readfds, fd\+\_\+set $\ast$writefds, fd\+\_\+set $\ast$exceptfds, struct timeval $\ast$timeout)
\begin{DoxyCompactList}\small\item\em select系统调用 \end{DoxyCompactList}\item 
static int \hyperlink{classdev_1_1net_1_1_socket_api_af0cdd3c603edd23ef36f104ef3179394}{ioctlsocket} (sock\+\_\+t sock, long cmd, u\+\_\+long $\ast$argp)
\begin{DoxyCompactList}\small\item\em 设置套接字\+I\+O模型 \end{DoxyCompactList}\item 
static bool \hyperlink{classdev_1_1net_1_1_socket_api_a14bf28751003dc86e20c60182e771e55}{setsocketnoblocking} (sock\+\_\+t sock, bool on)
\begin{DoxyCompactList}\small\item\em 设置套接字\+I\+O模型 \end{DoxyCompactList}\item 
static bool \hyperlink{classdev_1_1net_1_1_socket_api_af2941c088aaa168f045e516f1710e54b}{setsocketlinger} (sock\+\_\+t sock, bool on)
\begin{DoxyCompactList}\small\item\em 设置套接字\+Linger选项 \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
本地套接字函数wrapper 

\subsection{Member Function Documentation}
\hypertarget{classdev_1_1net_1_1_socket_api_a2e9851418b2c871852e441f73c1df495}{}\index{dev\+::net\+::\+Socket\+Api@{dev\+::net\+::\+Socket\+Api}!accept@{accept}}
\index{accept@{accept}!dev\+::net\+::\+Socket\+Api@{dev\+::net\+::\+Socket\+Api}}
\subsubsection[{accept(sock\+\_\+t sockfd, struct sockaddr $\ast$addr, socklen\+\_\+t $\ast$addrlen)}]{\setlength{\rightskip}{0pt plus 5cm}static sock\+\_\+t dev\+::net\+::\+Socket\+Api\+::accept (
\begin{DoxyParamCaption}
\item[{sock\+\_\+t}]{sockfd, }
\item[{struct sockaddr $\ast$}]{addr, }
\item[{socklen\+\_\+t $\ast$}]{addrlen}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}\label{classdev_1_1net_1_1_socket_api_a2e9851418b2c871852e441f73c1df495}


接收监听套接字上的连接 


\begin{DoxyParams}{Parameters}
{\em sockfd} & 监听套接字句柄 \\
\hline
{\em addr} & 连接的对端地址 \\
\hline
{\em addrlen} & 地址长度 \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
成功返回套接字句柄，失败返回\+I\+N\+V\+A\+L\+I\+D\+\_\+\+S\+O\+C\+K\+E\+T 
\end{DoxyReturn}
\hypertarget{classdev_1_1net_1_1_socket_api_ab9e728b6cb0b7932e73acbb250489e25}{}\index{dev\+::net\+::\+Socket\+Api@{dev\+::net\+::\+Socket\+Api}!bind@{bind}}
\index{bind@{bind}!dev\+::net\+::\+Socket\+Api@{dev\+::net\+::\+Socket\+Api}}
\subsubsection[{bind(sock\+\_\+t sockfd, const struct sockaddr $\ast$addr, socklen\+\_\+t addrlen)}]{\setlength{\rightskip}{0pt plus 5cm}static bool dev\+::net\+::\+Socket\+Api\+::bind (
\begin{DoxyParamCaption}
\item[{sock\+\_\+t}]{sockfd, }
\item[{const struct sockaddr $\ast$}]{addr, }
\item[{socklen\+\_\+t}]{addrlen}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}\label{classdev_1_1net_1_1_socket_api_ab9e728b6cb0b7932e73acbb250489e25}


绑定套接字到指定地址 


\begin{DoxyParams}{Parameters}
{\em sockfd} & 套接字句柄 \\
\hline
{\em addr} & 需要绑定的地址 \\
\hline
{\em addrlen} & 地址长度 \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
成功返回true 
\end{DoxyReturn}
\hypertarget{classdev_1_1net_1_1_socket_api_acab670d7ff1243462f782676d5f26931}{}\index{dev\+::net\+::\+Socket\+Api@{dev\+::net\+::\+Socket\+Api}!close@{close}}
\index{close@{close}!dev\+::net\+::\+Socket\+Api@{dev\+::net\+::\+Socket\+Api}}
\subsubsection[{close(sock\+\_\+t sockfd)}]{\setlength{\rightskip}{0pt plus 5cm}static bool dev\+::net\+::\+Socket\+Api\+::close (
\begin{DoxyParamCaption}
\item[{sock\+\_\+t}]{sockfd}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}\label{classdev_1_1net_1_1_socket_api_acab670d7ff1243462f782676d5f26931}


关闭指定套接字 


\begin{DoxyParams}{Parameters}
{\em sockfd} & 套接字句柄 \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
成功返回true 
\end{DoxyReturn}
\hypertarget{classdev_1_1net_1_1_socket_api_a4ac36cc16daf7f35ac40e70fdd52391b}{}\index{dev\+::net\+::\+Socket\+Api@{dev\+::net\+::\+Socket\+Api}!connect@{connect}}
\index{connect@{connect}!dev\+::net\+::\+Socket\+Api@{dev\+::net\+::\+Socket\+Api}}
\subsubsection[{connect(sock\+\_\+t sockfd, const struct sockaddr $\ast$addr, socklen\+\_\+t addrlen)}]{\setlength{\rightskip}{0pt plus 5cm}static bool dev\+::net\+::\+Socket\+Api\+::connect (
\begin{DoxyParamCaption}
\item[{sock\+\_\+t}]{sockfd, }
\item[{const struct sockaddr $\ast$}]{addr, }
\item[{socklen\+\_\+t}]{addrlen}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}\label{classdev_1_1net_1_1_socket_api_a4ac36cc16daf7f35ac40e70fdd52391b}


使用指定套接字连接到服务器 


\begin{DoxyParams}{Parameters}
{\em sockfd} & 套接字句柄 \\
\hline
{\em addr} & 服务器地址 \\
\hline
{\em addrlen} & 地址长度 \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
成功返回true 
\end{DoxyReturn}
\hypertarget{classdev_1_1net_1_1_socket_api_a2139efc71f04f29f6cd6d47217a68fc6}{}\index{dev\+::net\+::\+Socket\+Api@{dev\+::net\+::\+Socket\+Api}!freeaddrinfo@{freeaddrinfo}}
\index{freeaddrinfo@{freeaddrinfo}!dev\+::net\+::\+Socket\+Api@{dev\+::net\+::\+Socket\+Api}}
\subsubsection[{freeaddrinfo(struct addrinfo $\ast$result)}]{\setlength{\rightskip}{0pt plus 5cm}static void dev\+::net\+::\+Socket\+Api\+::freeaddrinfo (
\begin{DoxyParamCaption}
\item[{struct addrinfo $\ast$}]{result}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}\label{classdev_1_1net_1_1_socket_api_a2139efc71f04f29f6cd6d47217a68fc6}


释放getaddrinfo返回的数据 


\begin{DoxyParams}{Parameters}
{\em result} & 要释放的数据 \\
\hline
\end{DoxyParams}
\hypertarget{classdev_1_1net_1_1_socket_api_ac30763c26a24cd674efa9e6804d9e448}{}\index{dev\+::net\+::\+Socket\+Api@{dev\+::net\+::\+Socket\+Api}!getaddrinfo@{getaddrinfo}}
\index{getaddrinfo@{getaddrinfo}!dev\+::net\+::\+Socket\+Api@{dev\+::net\+::\+Socket\+Api}}
\subsubsection[{getaddrinfo(const char $\ast$host, const char $\ast$service, const struct addrinfo $\ast$hints, struct addrinfo $\ast$$\ast$result)}]{\setlength{\rightskip}{0pt plus 5cm}static bool dev\+::net\+::\+Socket\+Api\+::getaddrinfo (
\begin{DoxyParamCaption}
\item[{const char $\ast$}]{host, }
\item[{const char $\ast$}]{service, }
\item[{const struct addrinfo $\ast$}]{hints, }
\item[{struct addrinfo $\ast$$\ast$}]{result}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}\label{classdev_1_1net_1_1_socket_api_ac30763c26a24cd674efa9e6804d9e448}


获取指定主机名和服务名的套接字地址列表 


\begin{DoxyParams}{Parameters}
{\em host} & 主机名 \\
\hline
{\em service} & 服务名 \\
\hline
{\em hints} & 指定返回的地址标准 \\
\hline
{\em result} & 结果 \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
失败返回false 
\end{DoxyReturn}
\hypertarget{classdev_1_1net_1_1_socket_api_a6137e6bc83ca8599a0e87c7534808c62}{}\index{dev\+::net\+::\+Socket\+Api@{dev\+::net\+::\+Socket\+Api}!getnameinfo@{getnameinfo}}
\index{getnameinfo@{getnameinfo}!dev\+::net\+::\+Socket\+Api@{dev\+::net\+::\+Socket\+Api}}
\subsubsection[{getnameinfo(const struct sockaddr $\ast$addr, socklen\+\_\+t addrlen, char $\ast$host, size\+\_\+t hostlen, char $\ast$service, size\+\_\+t servlen, int flags)}]{\setlength{\rightskip}{0pt plus 5cm}static bool dev\+::net\+::\+Socket\+Api\+::getnameinfo (
\begin{DoxyParamCaption}
\item[{const struct sockaddr $\ast$}]{addr, }
\item[{socklen\+\_\+t}]{addrlen, }
\item[{char $\ast$}]{host, }
\item[{size\+\_\+t}]{hostlen, }
\item[{char $\ast$}]{service, }
\item[{size\+\_\+t}]{servlen, }
\item[{int}]{flags}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}\label{classdev_1_1net_1_1_socket_api_a6137e6bc83ca8599a0e87c7534808c62}


获取指定套接字地址的主机名和服务名 


\begin{DoxyParams}{Parameters}
{\em addr} & 套接字地址 \\
\hline
{\em addrlen} & 地址长度 \\
\hline
{\em host} & 主机名缓存 \\
\hline
{\em hostlen} & 缓存长度 \\
\hline
{\em service} & 服务名缓存 \\
\hline
{\em servlen} & 缓存长度 \\
\hline
{\em flags} & 标志 \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
失败返回false 
\end{DoxyReturn}
\hypertarget{classdev_1_1net_1_1_socket_api_afb96ed718ee882239929e15f68f4cfa1}{}\index{dev\+::net\+::\+Socket\+Api@{dev\+::net\+::\+Socket\+Api}!getpeername@{getpeername}}
\index{getpeername@{getpeername}!dev\+::net\+::\+Socket\+Api@{dev\+::net\+::\+Socket\+Api}}
\subsubsection[{getpeername(sock\+\_\+t sockfd, struct sockaddr $\ast$addr, socklen\+\_\+t $\ast$addrlen)}]{\setlength{\rightskip}{0pt plus 5cm}static bool dev\+::net\+::\+Socket\+Api\+::getpeername (
\begin{DoxyParamCaption}
\item[{sock\+\_\+t}]{sockfd, }
\item[{struct sockaddr $\ast$}]{addr, }
\item[{socklen\+\_\+t $\ast$}]{addrlen}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}\label{classdev_1_1net_1_1_socket_api_afb96ed718ee882239929e15f68f4cfa1}


获取套接字远程地址 


\begin{DoxyParams}{Parameters}
{\em sockfd} & 套接字句柄 \\
\hline
{\em addr} & 地址缓存 \\
\hline
{\em addrlen} & 地址长度 \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
失败返回false 
\end{DoxyReturn}
\hypertarget{classdev_1_1net_1_1_socket_api_acdaa0a5aadc721422f748f8f931daa53}{}\index{dev\+::net\+::\+Socket\+Api@{dev\+::net\+::\+Socket\+Api}!getsockname@{getsockname}}
\index{getsockname@{getsockname}!dev\+::net\+::\+Socket\+Api@{dev\+::net\+::\+Socket\+Api}}
\subsubsection[{getsockname(sock\+\_\+t sockfd, struct sockaddr $\ast$addr, socklen\+\_\+t $\ast$addrlen)}]{\setlength{\rightskip}{0pt plus 5cm}static bool dev\+::net\+::\+Socket\+Api\+::getsockname (
\begin{DoxyParamCaption}
\item[{sock\+\_\+t}]{sockfd, }
\item[{struct sockaddr $\ast$}]{addr, }
\item[{socklen\+\_\+t $\ast$}]{addrlen}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}\label{classdev_1_1net_1_1_socket_api_acdaa0a5aadc721422f748f8f931daa53}


获取套接字本地地址 


\begin{DoxyParams}{Parameters}
{\em sockfd} & 套接字句柄 \\
\hline
{\em addr} & 地址缓存 \\
\hline
{\em addrlen} & 地址长度 \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
失败返回false 
\end{DoxyReturn}
\hypertarget{classdev_1_1net_1_1_socket_api_a508935c561a3841e65d6a7e794503758}{}\index{dev\+::net\+::\+Socket\+Api@{dev\+::net\+::\+Socket\+Api}!getsockopt@{getsockopt}}
\index{getsockopt@{getsockopt}!dev\+::net\+::\+Socket\+Api@{dev\+::net\+::\+Socket\+Api}}
\subsubsection[{getsockopt(sock\+\_\+t sockfd, int level, int optname, void $\ast$optval, socklen\+\_\+t $\ast$optlen)}]{\setlength{\rightskip}{0pt plus 5cm}static bool dev\+::net\+::\+Socket\+Api\+::getsockopt (
\begin{DoxyParamCaption}
\item[{sock\+\_\+t}]{sockfd, }
\item[{int}]{level, }
\item[{int}]{optname, }
\item[{void $\ast$}]{optval, }
\item[{socklen\+\_\+t $\ast$}]{optlen}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}\label{classdev_1_1net_1_1_socket_api_a508935c561a3841e65d6a7e794503758}


获取套接字选项 


\begin{DoxyParams}{Parameters}
{\em sockfd} & 套接字句柄 \\
\hline
{\em level} & 等级 \\
\hline
{\em optname} & 选择名 \\
\hline
{\em optval} & 选择值 \\
\hline
{\em optlen} & 选择值长度 \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
失败返回false 
\end{DoxyReturn}
\hypertarget{classdev_1_1net_1_1_socket_api_a349f48bfc1f677bc3361a0be8ab47783}{}\index{dev\+::net\+::\+Socket\+Api@{dev\+::net\+::\+Socket\+Api}!htonl@{htonl}}
\index{htonl@{htonl}!dev\+::net\+::\+Socket\+Api@{dev\+::net\+::\+Socket\+Api}}
\subsubsection[{htonl(uint32\+\_\+t host\+\_\+uint32)}]{\setlength{\rightskip}{0pt plus 5cm}static uint32\+\_\+t dev\+::net\+::\+Socket\+Api\+::htonl (
\begin{DoxyParamCaption}
\item[{uint32\+\_\+t}]{host\+\_\+uint32}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}\label{classdev_1_1net_1_1_socket_api_a349f48bfc1f677bc3361a0be8ab47783}


主机字节序转换为网络字节序 


\begin{DoxyParams}{Parameters}
{\em host\+\_\+uint32} & 32位变量 \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
成功返回true 
\end{DoxyReturn}
\hypertarget{classdev_1_1net_1_1_socket_api_a2dadafc2cc647d97ab5091e8dc12195c}{}\index{dev\+::net\+::\+Socket\+Api@{dev\+::net\+::\+Socket\+Api}!htons@{htons}}
\index{htons@{htons}!dev\+::net\+::\+Socket\+Api@{dev\+::net\+::\+Socket\+Api}}
\subsubsection[{htons(uint16\+\_\+t host\+\_\+uint16)}]{\setlength{\rightskip}{0pt plus 5cm}static uint16\+\_\+t dev\+::net\+::\+Socket\+Api\+::htons (
\begin{DoxyParamCaption}
\item[{uint16\+\_\+t}]{host\+\_\+uint16}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}\label{classdev_1_1net_1_1_socket_api_a2dadafc2cc647d97ab5091e8dc12195c}


主机字节序转换为网络字节序 


\begin{DoxyParams}{Parameters}
{\em host\+\_\+uint16} & 16位变量 \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
成功返回true 
\end{DoxyReturn}
\hypertarget{classdev_1_1net_1_1_socket_api_a3ae6728572945a50592d06e06ca1681c}{}\index{dev\+::net\+::\+Socket\+Api@{dev\+::net\+::\+Socket\+Api}!inet\+\_\+ntop@{inet\+\_\+ntop}}
\index{inet\+\_\+ntop@{inet\+\_\+ntop}!dev\+::net\+::\+Socket\+Api@{dev\+::net\+::\+Socket\+Api}}
\subsubsection[{inet\+\_\+ntop(int domain, const void $\ast$addrptr, char $\ast$dst\+\_\+ptr, size\+\_\+t len)}]{\setlength{\rightskip}{0pt plus 5cm}static const char$\ast$ dev\+::net\+::\+Socket\+Api\+::inet\+\_\+ntop (
\begin{DoxyParamCaption}
\item[{int}]{domain, }
\item[{const void $\ast$}]{addrptr, }
\item[{char $\ast$}]{dst\+\_\+ptr, }
\item[{size\+\_\+t}]{len}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}\label{classdev_1_1net_1_1_socket_api_a3ae6728572945a50592d06e06ca1681c}


转换二进制格式的地址为点分十进制表示 


\begin{DoxyParams}{Parameters}
{\em domain} & 套接字所属域 \\
\hline
{\em addrptr} & 二进制格式的地址 \\
\hline
{\em dst\+\_\+ptr} & 接收转换后地址缓存 \\
\hline
{\em len} & 缓存长度 \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
失败返回\+N\+U\+L\+L 
\end{DoxyReturn}
\hypertarget{classdev_1_1net_1_1_socket_api_a191d49266fd9aa8149240009fa204e98}{}\index{dev\+::net\+::\+Socket\+Api@{dev\+::net\+::\+Socket\+Api}!inet\+\_\+pton@{inet\+\_\+pton}}
\index{inet\+\_\+pton@{inet\+\_\+pton}!dev\+::net\+::\+Socket\+Api@{dev\+::net\+::\+Socket\+Api}}
\subsubsection[{inet\+\_\+pton(int domain, const char $\ast$src\+\_\+str, void $\ast$addrptr)}]{\setlength{\rightskip}{0pt plus 5cm}static int dev\+::net\+::\+Socket\+Api\+::inet\+\_\+pton (
\begin{DoxyParamCaption}
\item[{int}]{domain, }
\item[{const char $\ast$}]{src\+\_\+str, }
\item[{void $\ast$}]{addrptr}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}\label{classdev_1_1net_1_1_socket_api_a191d49266fd9aa8149240009fa204e98}


转换点分十进制表示的地址为二进制格式 


\begin{DoxyParams}{Parameters}
{\em domain} & 套接字所属域 \\
\hline
{\em src\+\_\+str} & 地址字符串 \\
\hline
{\em addrptr} & 接收转换后地址缓存 \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
成功返回1，地址格式错误返回0，失败返回-\/1 
\end{DoxyReturn}
\hypertarget{classdev_1_1net_1_1_socket_api_af0cdd3c603edd23ef36f104ef3179394}{}\index{dev\+::net\+::\+Socket\+Api@{dev\+::net\+::\+Socket\+Api}!ioctlsocket@{ioctlsocket}}
\index{ioctlsocket@{ioctlsocket}!dev\+::net\+::\+Socket\+Api@{dev\+::net\+::\+Socket\+Api}}
\subsubsection[{ioctlsocket(sock\+\_\+t sock, long cmd, u\+\_\+long $\ast$argp)}]{\setlength{\rightskip}{0pt plus 5cm}static int dev\+::net\+::\+Socket\+Api\+::ioctlsocket (
\begin{DoxyParamCaption}
\item[{sock\+\_\+t}]{sock, }
\item[{long}]{cmd, }
\item[{u\+\_\+long $\ast$}]{argp}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}\label{classdev_1_1net_1_1_socket_api_af0cdd3c603edd23ef36f104ef3179394}


设置套接字\+I\+O模型 


\begin{DoxyParams}{Parameters}
{\em sock} & 套接字句柄 \\
\hline
{\em cmd} & 检查读就绪的集合 \\
\hline
{\em argp} & 检查写就绪的集合 \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
成功返回0，失败返回-\/1 
\end{DoxyReturn}
\hypertarget{classdev_1_1net_1_1_socket_api_a0cc819e43ff24147028aecbe7258b08e}{}\index{dev\+::net\+::\+Socket\+Api@{dev\+::net\+::\+Socket\+Api}!listen@{listen}}
\index{listen@{listen}!dev\+::net\+::\+Socket\+Api@{dev\+::net\+::\+Socket\+Api}}
\subsubsection[{listen(sock\+\_\+t sockfd, int backlog)}]{\setlength{\rightskip}{0pt plus 5cm}static bool dev\+::net\+::\+Socket\+Api\+::listen (
\begin{DoxyParamCaption}
\item[{sock\+\_\+t}]{sockfd, }
\item[{int}]{backlog}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}\label{classdev_1_1net_1_1_socket_api_a0cc819e43ff24147028aecbe7258b08e}


在指定套接字上启动监听 


\begin{DoxyParams}{Parameters}
{\em sockfd} & 套接字句柄 \\
\hline
{\em backlog} & 接受连接队列长度(如果队列满了后续到达的连接会关闭) \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
成功返回true 
\end{DoxyReturn}
\hypertarget{classdev_1_1net_1_1_socket_api_ab645166633b0002c46951033027d022c}{}\index{dev\+::net\+::\+Socket\+Api@{dev\+::net\+::\+Socket\+Api}!ntohl@{ntohl}}
\index{ntohl@{ntohl}!dev\+::net\+::\+Socket\+Api@{dev\+::net\+::\+Socket\+Api}}
\subsubsection[{ntohl(uint32\+\_\+t net\+\_\+uint32)}]{\setlength{\rightskip}{0pt plus 5cm}static uint32\+\_\+t dev\+::net\+::\+Socket\+Api\+::ntohl (
\begin{DoxyParamCaption}
\item[{uint32\+\_\+t}]{net\+\_\+uint32}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}\label{classdev_1_1net_1_1_socket_api_ab645166633b0002c46951033027d022c}


网络字节序转换为主机字节序 


\begin{DoxyParams}{Parameters}
{\em net\+\_\+uint32} & 32位变量 \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
成功返回true 
\end{DoxyReturn}
\hypertarget{classdev_1_1net_1_1_socket_api_a4dd6d37153baf0f3b28a1a86e9e3513b}{}\index{dev\+::net\+::\+Socket\+Api@{dev\+::net\+::\+Socket\+Api}!ntohs@{ntohs}}
\index{ntohs@{ntohs}!dev\+::net\+::\+Socket\+Api@{dev\+::net\+::\+Socket\+Api}}
\subsubsection[{ntohs(uint16\+\_\+t net\+\_\+uint16)}]{\setlength{\rightskip}{0pt plus 5cm}static uint16\+\_\+t dev\+::net\+::\+Socket\+Api\+::ntohs (
\begin{DoxyParamCaption}
\item[{uint16\+\_\+t}]{net\+\_\+uint16}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}\label{classdev_1_1net_1_1_socket_api_a4dd6d37153baf0f3b28a1a86e9e3513b}


网络字节序转换为主机字节序 


\begin{DoxyParams}{Parameters}
{\em net\+\_\+uint16} & 16位变量 \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
成功返回true 
\end{DoxyReturn}
\hypertarget{classdev_1_1net_1_1_socket_api_ab5620cca4671a803d43ff11cddd29430}{}\index{dev\+::net\+::\+Socket\+Api@{dev\+::net\+::\+Socket\+Api}!recv@{recv}}
\index{recv@{recv}!dev\+::net\+::\+Socket\+Api@{dev\+::net\+::\+Socket\+Api}}
\subsubsection[{recv(sock\+\_\+t sockfd, void $\ast$buffer, size\+\_\+t length, int flags)}]{\setlength{\rightskip}{0pt plus 5cm}static ssize\+\_\+t dev\+::net\+::\+Socket\+Api\+::recv (
\begin{DoxyParamCaption}
\item[{sock\+\_\+t}]{sockfd, }
\item[{void $\ast$}]{buffer, }
\item[{size\+\_\+t}]{length, }
\item[{int}]{flags}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}\label{classdev_1_1net_1_1_socket_api_ab5620cca4671a803d43ff11cddd29430}


接受数据 


\begin{DoxyParams}{Parameters}
{\em sockfd} & 套接字句柄 \\
\hline
{\em buffer} & 缓存 \\
\hline
{\em length} & 缓存长度 \\
\hline
{\em flags} & 标志 \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
发生错误返回-\/1，数据接收完毕返回\+E\+O\+F，其他情况返回接收的数据长度 
\end{DoxyReturn}
\hypertarget{classdev_1_1net_1_1_socket_api_adea576bbc110685fbf0bd1faa36dd1f6}{}\index{dev\+::net\+::\+Socket\+Api@{dev\+::net\+::\+Socket\+Api}!recvfrom@{recvfrom}}
\index{recvfrom@{recvfrom}!dev\+::net\+::\+Socket\+Api@{dev\+::net\+::\+Socket\+Api}}
\subsubsection[{recvfrom(sock\+\_\+t sockfd, void $\ast$buffer, size\+\_\+t length, int flags, struct sockaddr $\ast$src\+\_\+addr, socklen\+\_\+t $\ast$addrlen)}]{\setlength{\rightskip}{0pt plus 5cm}static ssize\+\_\+t dev\+::net\+::\+Socket\+Api\+::recvfrom (
\begin{DoxyParamCaption}
\item[{sock\+\_\+t}]{sockfd, }
\item[{void $\ast$}]{buffer, }
\item[{size\+\_\+t}]{length, }
\item[{int}]{flags, }
\item[{struct sockaddr $\ast$}]{src\+\_\+addr, }
\item[{socklen\+\_\+t $\ast$}]{addrlen}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}\label{classdev_1_1net_1_1_socket_api_adea576bbc110685fbf0bd1faa36dd1f6}


接受数据报 


\begin{DoxyParams}{Parameters}
{\em sockfd} & 套接字句柄 \\
\hline
{\em buffer} & 缓存 \\
\hline
{\em length} & 缓存长度 \\
\hline
{\em flags} & 标志 \\
\hline
{\em src\+\_\+addr} & 服务器地址 \\
\hline
{\em addrlen} & 地址长度 \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
发生错误返回-\/1，数据接收完毕返回\+E\+O\+F，其他情况返回接收的数据长度 
\end{DoxyReturn}
\hypertarget{classdev_1_1net_1_1_socket_api_af8c6ff0f1ef50696e975920048a4ebf9}{}\index{dev\+::net\+::\+Socket\+Api@{dev\+::net\+::\+Socket\+Api}!select@{select}}
\index{select@{select}!dev\+::net\+::\+Socket\+Api@{dev\+::net\+::\+Socket\+Api}}
\subsubsection[{select(int nfds, fd\+\_\+set $\ast$readfds, fd\+\_\+set $\ast$writefds, fd\+\_\+set $\ast$exceptfds, struct timeval $\ast$timeout)}]{\setlength{\rightskip}{0pt plus 5cm}static int dev\+::net\+::\+Socket\+Api\+::select (
\begin{DoxyParamCaption}
\item[{int}]{nfds, }
\item[{fd\+\_\+set $\ast$}]{readfds, }
\item[{fd\+\_\+set $\ast$}]{writefds, }
\item[{fd\+\_\+set $\ast$}]{exceptfds, }
\item[{struct timeval $\ast$}]{timeout}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}\label{classdev_1_1net_1_1_socket_api_af8c6ff0f1ef50696e975920048a4ebf9}


select系统调用 


\begin{DoxyParams}{Parameters}
{\em nfds} & 套接字句柄 \\
\hline
{\em readfds} & 检查读就绪的集合 \\
\hline
{\em writefds} & 检查写就绪的集合 \\
\hline
{\em exceptfds} & 检查异常的集合 \\
\hline
{\em timeout} & 超时时间 \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
失败返回-\/1，超时返回0，其他情况返回就绪的文件描述符数量 
\end{DoxyReturn}
\hypertarget{classdev_1_1net_1_1_socket_api_a6747c98d432dda18d52ca8602d5c024c}{}\index{dev\+::net\+::\+Socket\+Api@{dev\+::net\+::\+Socket\+Api}!send@{send}}
\index{send@{send}!dev\+::net\+::\+Socket\+Api@{dev\+::net\+::\+Socket\+Api}}
\subsubsection[{send(sock\+\_\+t sockfd, const void $\ast$buffer, size\+\_\+t length, int flags)}]{\setlength{\rightskip}{0pt plus 5cm}static ssize\+\_\+t dev\+::net\+::\+Socket\+Api\+::send (
\begin{DoxyParamCaption}
\item[{sock\+\_\+t}]{sockfd, }
\item[{const void $\ast$}]{buffer, }
\item[{size\+\_\+t}]{length, }
\item[{int}]{flags}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}\label{classdev_1_1net_1_1_socket_api_a6747c98d432dda18d52ca8602d5c024c}


发送数据 


\begin{DoxyParams}{Parameters}
{\em sockfd} & 套接字句柄 \\
\hline
{\em buffer} & 缓存 \\
\hline
{\em length} & 缓存长度 \\
\hline
{\em flags} & 标志 \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
发生错误返回-\/1，其他情况返回发送的数据长度 
\end{DoxyReturn}
\hypertarget{classdev_1_1net_1_1_socket_api_a74d39e1ca0169a15f8e4cc6c6f9756ab}{}\index{dev\+::net\+::\+Socket\+Api@{dev\+::net\+::\+Socket\+Api}!sendto@{sendto}}
\index{sendto@{sendto}!dev\+::net\+::\+Socket\+Api@{dev\+::net\+::\+Socket\+Api}}
\subsubsection[{sendto(sock\+\_\+t sockfd, void $\ast$buffer, size\+\_\+t length, int flags, struct sockaddr $\ast$dest\+\_\+addr, socklen\+\_\+t addrlen)}]{\setlength{\rightskip}{0pt plus 5cm}static ssize\+\_\+t dev\+::net\+::\+Socket\+Api\+::sendto (
\begin{DoxyParamCaption}
\item[{sock\+\_\+t}]{sockfd, }
\item[{void $\ast$}]{buffer, }
\item[{size\+\_\+t}]{length, }
\item[{int}]{flags, }
\item[{struct sockaddr $\ast$}]{dest\+\_\+addr, }
\item[{socklen\+\_\+t}]{addrlen}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}\label{classdev_1_1net_1_1_socket_api_a74d39e1ca0169a15f8e4cc6c6f9756ab}


发送数据报 


\begin{DoxyParams}{Parameters}
{\em sockfd} & 套接字句柄 \\
\hline
{\em buffer} & 缓存 \\
\hline
{\em length} & 缓存长度 \\
\hline
{\em flags} & 标志 \\
\hline
{\em dest\+\_\+addr} & 服务器地址 \\
\hline
{\em addrlen} & 地址长度 \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
发生错误返回-\/1，其他情况返回发送的数据长度 
\end{DoxyReturn}
\hypertarget{classdev_1_1net_1_1_socket_api_af2941c088aaa168f045e516f1710e54b}{}\index{dev\+::net\+::\+Socket\+Api@{dev\+::net\+::\+Socket\+Api}!setsocketlinger@{setsocketlinger}}
\index{setsocketlinger@{setsocketlinger}!dev\+::net\+::\+Socket\+Api@{dev\+::net\+::\+Socket\+Api}}
\subsubsection[{setsocketlinger(sock\+\_\+t sock, bool on)}]{\setlength{\rightskip}{0pt plus 5cm}static bool dev\+::net\+::\+Socket\+Api\+::setsocketlinger (
\begin{DoxyParamCaption}
\item[{sock\+\_\+t}]{sock, }
\item[{bool}]{on}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}\label{classdev_1_1net_1_1_socket_api_af2941c088aaa168f045e516f1710e54b}


设置套接字\+Linger选项 


\begin{DoxyParams}{Parameters}
{\em sock} & 套接字句柄 \\
\hline
{\em on} & 是否设置为非阻塞 \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
成功返回true 
\end{DoxyReturn}
\hypertarget{classdev_1_1net_1_1_socket_api_a14bf28751003dc86e20c60182e771e55}{}\index{dev\+::net\+::\+Socket\+Api@{dev\+::net\+::\+Socket\+Api}!setsocketnoblocking@{setsocketnoblocking}}
\index{setsocketnoblocking@{setsocketnoblocking}!dev\+::net\+::\+Socket\+Api@{dev\+::net\+::\+Socket\+Api}}
\subsubsection[{setsocketnoblocking(sock\+\_\+t sock, bool on)}]{\setlength{\rightskip}{0pt plus 5cm}static bool dev\+::net\+::\+Socket\+Api\+::setsocketnoblocking (
\begin{DoxyParamCaption}
\item[{sock\+\_\+t}]{sock, }
\item[{bool}]{on}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}\label{classdev_1_1net_1_1_socket_api_a14bf28751003dc86e20c60182e771e55}


设置套接字\+I\+O模型 


\begin{DoxyParams}{Parameters}
{\em sock} & 套接字句柄 \\
\hline
{\em on} & 是否设置为非阻塞 \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
成功返回true 
\end{DoxyReturn}
\hypertarget{classdev_1_1net_1_1_socket_api_aebfd2453f8424cebb9dc467d1cea40dd}{}\index{dev\+::net\+::\+Socket\+Api@{dev\+::net\+::\+Socket\+Api}!setsockopt@{setsockopt}}
\index{setsockopt@{setsockopt}!dev\+::net\+::\+Socket\+Api@{dev\+::net\+::\+Socket\+Api}}
\subsubsection[{setsockopt(sock\+\_\+t sockfd, int level, int optname, const void $\ast$optval, socklen\+\_\+t optlen)}]{\setlength{\rightskip}{0pt plus 5cm}static bool dev\+::net\+::\+Socket\+Api\+::setsockopt (
\begin{DoxyParamCaption}
\item[{sock\+\_\+t}]{sockfd, }
\item[{int}]{level, }
\item[{int}]{optname, }
\item[{const void $\ast$}]{optval, }
\item[{socklen\+\_\+t}]{optlen}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}\label{classdev_1_1net_1_1_socket_api_aebfd2453f8424cebb9dc467d1cea40dd}


设置套接字选项 


\begin{DoxyParams}{Parameters}
{\em sockfd} & 套接字句柄 \\
\hline
{\em level} & 等级 \\
\hline
{\em optname} & 选择名 \\
\hline
{\em optval} & 选择值 \\
\hline
{\em optlen} & 选择值长度 \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
失败返回false 
\end{DoxyReturn}
\hypertarget{classdev_1_1net_1_1_socket_api_aca13c6bb87f3118f3dd2c008238e3a5a}{}\index{dev\+::net\+::\+Socket\+Api@{dev\+::net\+::\+Socket\+Api}!shutdown@{shutdown}}
\index{shutdown@{shutdown}!dev\+::net\+::\+Socket\+Api@{dev\+::net\+::\+Socket\+Api}}
\subsubsection[{shutdown(sock\+\_\+t sockfd, int how)}]{\setlength{\rightskip}{0pt plus 5cm}static bool dev\+::net\+::\+Socket\+Api\+::shutdown (
\begin{DoxyParamCaption}
\item[{sock\+\_\+t}]{sockfd, }
\item[{int}]{how}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}\label{classdev_1_1net_1_1_socket_api_aca13c6bb87f3118f3dd2c008238e3a5a}


关闭套接字一端 


\begin{DoxyParams}{Parameters}
{\em sockfd} & 套接字句柄 \\
\hline
{\em how} & 关闭读$\vert$关闭写 \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
成功返回true 
\end{DoxyReturn}
\hypertarget{classdev_1_1net_1_1_socket_api_a468438c9663cdc534e3bf628c29e7c75}{}\index{dev\+::net\+::\+Socket\+Api@{dev\+::net\+::\+Socket\+Api}!socket@{socket}}
\index{socket@{socket}!dev\+::net\+::\+Socket\+Api@{dev\+::net\+::\+Socket\+Api}}
\subsubsection[{socket(int domain, int type, int protocol=0)}]{\setlength{\rightskip}{0pt plus 5cm}static sock\+\_\+t dev\+::net\+::\+Socket\+Api\+::socket (
\begin{DoxyParamCaption}
\item[{int}]{domain, }
\item[{int}]{type, }
\item[{int}]{protocol = {\ttfamily 0}}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}\label{classdev_1_1net_1_1_socket_api_a468438c9663cdc534e3bf628c29e7c75}


创建一个套接字 


\begin{DoxyParams}{Parameters}
{\em domain} & 套接字所属域 \\
\hline
{\em type} & 套接字类型(流套接字$\vert$数据报套接字) \\
\hline
{\em protocol} & 协议类型(0) \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
成功返回套接字句柄，失败返回\+I\+N\+V\+A\+L\+I\+D\+\_\+\+S\+O\+C\+K\+E\+T 
\end{DoxyReturn}


The documentation for this class was generated from the following file\+:\begin{DoxyCompactItemize}
\item 
dev/dev/net/Socket\+Api.\+hpp\end{DoxyCompactItemize}
